package com.situ.mymall.controller;

import com.situ.mymall.pojo.entity.User;
import com.situ.mymall.pojo.query.UserQuery;
import com.situ.mymall.service.IUserService;
import com.situ.mymall.util.PageResult;
import com.situ.mymall.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping("/list")
    public PageResult list(UserQuery userQuery){
        return userService.list(userQuery);
    }

    @RequestMapping("/selectById")
    public Result selectById(Integer id){
        User user = userService.selectById(id);
        return Result.ok(user);
    }

    @RequestMapping("/updateStatus")
    public Result updateStatus(Integer id,Integer status){
        userService.updateStatus(id,status);
        return Result.ok("更新成功");
    }


}
